package com.xmy.cultivate.listeners;

import com.xmy.cultivate.entity.*;
import com.xmy.cultivate.service.IMqPushService;
import com.xmy.cultivate.service.IStudentGradeService;
import com.xmy.cultivate.service.IWecharPushService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import static com.xmy.cultivate.constants.MqConstants.*;

@Slf4j
@Component
public class StudentGradeListener {

    @Autowired
    IMqPushService iMqPushService;

    @Autowired
    IStudentGradeService iStudentGradeService;


    /**
     *  更新续报信息
     * @param
     */
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(name = QUEUE_ERP_STUDENT_GRADE_IS_PRESORT_Q1, durable = "true"),
//            exchange = @Exchange(name = EXCHANGE_ERP_STUDENT_GRADE_IS_PRESORT_FANOUT, delayed = "true")
//    ))
//    public void updateIsPresort(StudentGrade studentGrade){
//        //log.info("接收到delay.queue的延迟消息2：{}", multiDelayMessage);
//        iStudentGradeService.updateIsPresort(studentGrade.getSchoolId(),studentGrade.getStudentId(),studentGrade.getYearPart(),studentGrade.getQuarterNum(),studentGrade.getSubjectsId(),studentGrade.getLessonType());
//    }
//
//    /**
//     *  记上课更新续报信息
//     * @param
//     */
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(name = QUEUE_ERP_STUDENT_GRADE_IS_PRESORT_FOR_RECORD_Q1, durable = "true"),
//            exchange = @Exchange(name = EXCHANGE_ERP_STUDENT_GRADE_IS_PRESORT_FOR_RECORD_FANOUT, delayed = "true")
//    ))
//    public void updateIsPresortForRecord(StudentGrade studentGrade){
//        //log.info("接收到delay.queue的延迟消息2：{}", multiDelayMessage);
//        iStudentGradeService.updateIsPresortForRecord(studentGrade.getSchoolId(),studentGrade.getStudentId(),studentGrade.getYearPart(),studentGrade.getQuarterNum(),studentGrade.getSubjectsId(),studentGrade.getLessonType());
//    }
//
//
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(name = QUEUE_ERP_STUDENT_GRADE_CLASS_TTYPE_ID_Q1, durable = "true"),
//            exchange = @Exchange(name = EXCHANGE_ERP_STUDENT_GRADE_CLASS_TTYPE_ID_FANOUT, delayed = "true")
//    ))
//    public void updateStudentGradeClassTypeId(StudentClassType studentClassType){
//        iStudentGradeService.updateStudentGradeClassTypeId(studentClassType);
//    }
//
//    /**
//     * 智能课或刷题班，自动分班
//     * @param studentGrade
//     */
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(name = QUEUE_ERP_ALOT_STUDENT_GRADE_AI_Q1, durable = "true"),
//            exchange = @Exchange(name = EXCHANGE_ERP_ALOT_STUDENT_GRADE_AI_FANOUT, delayed = "true")
//    ))
//    public void autoAllotStudentGrade(StudentGrade studentGrade){
//        //固定为2025春季班，到下个学期时再调整
//        if (studentGrade.getYearPart().equals(2025) && studentGrade.getQuarterNum().equals(3)) {
//            iStudentGradeService.autoAllotStudentGrade(studentGrade);
//        }
//
//    }
//
//    /**
//     * 多期缴费量数据统计
//     *
//     * @param rateQuantityPay
//     */
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(name = QUEUE_ERP_ALOT_STUDENT_REPEATEDLY_PAYS_Q1, durable = "true"),
//            exchange = @Exchange(name = EXCHANGE_ERP_ALOT_STUDENT_REPEATEDLY_PAYS_FANOUT, delayed = "true")
//    ))
//    public void repeatedlyPays(RateQuantityPay rateQuantityPay) {
//        if (rateQuantityPay != null) {
//
//
//        }
//    }
}
